<!-- Start of Main -->
<div class="main mt10">
	<div class="breadCrumb">
    <div class="fl"><span class="cRed">当前位置：</span><a href="<?php echo CHtml::normalizeUrl(array('/')) ?>">首页</a>&nbsp;&rsaquo;&nbsp;<?php if($category->taxonomy[0]->getParent() !== null) : ?><a href="<?php echo CHtml::normalizeUrl(array('/posts/category', 'id' => $category->taxonomy[0]->getParent()->termTaxonomyId)); ?>"><?php echo $category->taxonomy[0]->getParent()->terms->name ?></a>&nbsp;&rsaquo;&nbsp;<?php endif ?><a href="<?php echo CHtml::normalizeUrl(array('category/view', 'id' => $category->taxonomy[0]->termTaxonomyId)); ?>"><?php echo $category->name ?></a>&nbsp;&rsaquo;&nbsp;<strong>正文</strong></div>
  	<?php echo CHtml::form(Yii::app()->baseUrl.'/index.php/posts/search', 'get', array('id' => 'search_form')); ?>
    <div class="searchS fr">
        &nbsp;<input name="key" type="text" size="25" style="height:14px;" />
        <input type="submit" value="搜 索" class="btnL1" />
    </div>
    <?php echo CHtml::endForm(); ?>
    </div> 
    <!-- Start of area2s -->
	<div class="mt20"></div>	
    <div class="area2s">
    	<!-- Start of Col1 -->
<?php $errors = Yii::app()->user->getFlash('errors'); ?>
    	<div class="col1">
        	<div class="artBody">
	        	<div class="title"><h2 class="psy"><span><strong><?php echo $category->name ?></strong></span></h2><span class="more fr mt10"><a href="<?php echo CHtml::normalizeUrl(array('category/view', 'id' => $category->taxonomy[0]->termTaxonomyId)); ?>">更多&gt;&gt;</a></span></div>
                <div class="content">
                	<h2><?php echo $post->postTitle; ?></h2>
                    <div class="artInfo">
                    	<div class="aHui"><span class="fl"><?php echo $post->postFrom == '' ? '' : '来源：'.$post->postFrom.'&nbsp;&nbsp;&nbsp;&nbsp;'; ?>发布者：<?php echo $post->author->userName(); ?></span><span class="operate fr"><!-- JiaThis Button BEGIN -->
<a href="http://www.jiathis.com/share.html" class="jiathis"><img src="http://www.jiathis.com/code/images/jiathis.gif" width="125" height="21" border="0" id="jiathis_a"/></a>
<script type="text/javascript" src="http://www.jiathis.com/code/jia.js" charset=utf-8></script>
<!-- JiaThis Button END -->&nbsp;<a href="" class="copylink" id="copy_link" onclick="copyToClipBoard(); return false;">复制链接</a>&nbsp;&nbsp;<a href="" onclick="javascript: window.print(); return false;" class="print">打印</a></span></div>
                        <div class="aRed"><span class="fl">时间：<?php echo toDate($post->postDate); ?>&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="fl">阅读次数：<?php echo $post->postRead; ?></span><span class="fr" >【<?php if($commentsCount > 0) : ?><a href="#commentsList">共有<?php echo $commentsCount; ?>条评论</a><?php else : ?>暂无评论<?php endif; ?>】&nbsp;&nbsp;【<a href="#postComment">我要评论</a>】</span></div>
                    </div>
                    <div class="artMain">
                    <p>
                    <?php echo $post->nl2br ? nl2br($post->postContent) : $post->postContent; ?>
					</p>
                    </div>
                    <div class="nextAndPrev">
						<?php if($prevPost !== null) : ?><div class="prevPost">上一篇：<a href="<?php echo $prevPost->getRewrittenUrl() ?>" title="<?php echo $prevPost->postTitle ?>"><?php echo truncStr($prevPost->postTitle, 54, '...') ?></a></div><?php endif ?>
						<?php if($nextPost !== null) : ?><div class="nextPost">下一篇：<a href="<?php echo $nextPost->getRewrittenUrl() ?>" title="<?php echo $nextPost->postTitle ?>"><?php echo truncStr($nextPost->postTitle, 54, '...') ?></a></div><?php endif ?>
					</div>
                    <div class="cb"></div>
                </div>
            </div>
    
            <div class="replyList mt20">
            	<div class="title aRed fb" id="t1"><?php if($commentsCount > 0) : ?><a href="#commentsList">共有<span>&thinsp;<?php echo $commentsCount; ?>&thinsp;</span>评论</a><?php else : ?>暂无评论<?php endif; ?>&nbsp;<span class="fn cHui1">|</span>&nbsp;<a href="#postComment">我要评论</a></div>
            	<?php if($commentsCount > 0) : ?>
                    <ul class="commentList mt10" id="commentsList">
                    <?php foreach($comments as $comment) : ?>
                       <li>
                            <div class="comment">
                            	<div class="posttime">发表于 <?php echo fromNow($comment->commentDate) ?></div>
                            	<div class="author">
								<?php if($comment->isByUser()) :?><img src="<?php echo $comment->author->getAvatarUrl('small') ?>" alt="<?php echo $comment->author(); ?>" title="<?php echo $comment->author(); ?>" /><?php else: ?><img src="<?php echo BBS_BASE_URL.'/images/avatars/noavatar.gif' ?>" width="48" height="48" /><?php endif ?>
								<?php if($comment->isByUser()) :?><a href="<?php echo CHtml::normalizeUrl(array('/users/viewprofile', 'id' => $comment->author->uid)) ?>" class="cGre"><?php endif ?><?php echo $comment->author(); ?><?php if($comment->isByUser()) :?></a><?php endif ?></div>
                            	<p><?php echo nl2br(htmlspecialchars($comment->commentContent)); ?></p>	
								<div class="cb"></div>
<!--                                 <span class="reply"><a href="#" class="cGre">回复此评论</a></span>-->
                            </div>
                        </li>
                    <?php endforeach; ?>
                    </ul>
                <?php endif; ?>
                    <?php $tComment = Yii::app()->user->getFlash('comment'); ?>
                    <?php $_comment = isset($tComment) ? $tComment : $_comment; ?>  
            </div>
            <div class="post mt10" id="postComment">
    			<div class="postInner">
        		<h3 id="t2">我也来评论</h3>
       			 <?php if( ! Users::isLogin()) : ?><div class="state mt10">您尚未<?php echo CHtml::link('登录', array('/users/signin', 'rf' => urlencode(Yii::app()->request->pathInfo).'/'), array('class' => 'cRed'))?>。还不是会员？点击<?php echo CHtml::link('这里', array('/users/signup'), array('class' => 'cRed')); ?>注册。</div>
				<?php else : ?><div class="mt10">您好，<span class="cRed"><?php echo Yii::app()->user->name; ?></span>，欢迎发表评论。</div><?php endif; ?>
              
                <?php echo CHtml::form(array('/posts/postComment'), 'POST'); ?>
                <?php echo CHtml::activeHiddenField($post, 'postId'); ?>
                <table cellpadding="0" cellspacing="0" class="mt10">
                	<?php if( ! Users::isLogin()) : ?><tr>
                    	<td width="15%" valign="top" class="tr">昵称：</td>
                    	<td><?php echo CHtml::activeTextField($_comment, 'commenter', array('size' => '25', 'class' => 'ipt3')); ?>&nbsp;&nbsp;</td>
                    </tr><?php endif; ?>
                    <tr>
                    	<td valign="top" class="tr">内容：</td>
                        <td><?php echo CHtml::activeTextArea($_comment, 'commentContent', array('class' => 'ipt3','style' => "width:400px; height:90px;")); ?></td>
                    </tr>
                    <tr>
                    	<td valign="top" class="tr">验证码：</td>
                        <td>
                            <?php echo CHtml::activeTextField($_comment, 'verifyCode', array('class' => 'ipt3', 'size' => '15')); ?>
                            <?php $this->widget('CCaptcha', array('captchaAction' => 'captcha', 'buttonLabel' => '看不清？换张图', 'buttonOptions' => array('class' => 'cOrg', 'height' => '25px', 'style' => "margin-left :5px;")))?>
                        </td>
                    </tr>
                    <?php if(count($errors) > 0) : ?>
                    <tr>
                    	<td></td>
                        <td>
                        <div class="notice_error"><?php foreach($errors as $error) : echo $error[0]; endforeach; ?></div>
                        </td>
                    </tr>
                    <?php endif; ?>
                    <tr>
                    	<td></td>
                        <td><input type="submit" class="btn1" value="提  交" /></td>
                    </tr>
                </table>
        		<?php echo CHtml::endForm(); ?>
        		</div>
			</div>  
        </div>

		<!-- End of Col1 -->
		
        <!-- Start of Col2 -->
        <div class="col2">
            <?php $this->widget('RelatedPosts', array('post' => $post)) ?>
			<div class="smallAd mt10"><?php echo CHtml::image(Yii::app()->baseUrl.'/images/a-exp1.png', '慧苑心理咨询专注于解决婚姻家庭亲子问题', array('title' => '慧苑心理咨询专注于解决婚姻家庭亲子问题')); ?></div>
            <?php $this->widget('HotThreads') ?>
			<div class="smallAd mt10"><?php echo CHtml::image(Yii::app()->baseUrl.'/images/a-exp2.png', '慧苑心理咨询专注于解决婚姻家庭亲子问题', array('title' => '慧苑心理咨询专注于解决婚姻家庭亲子问题')); ?></div>
            <?php $this->widget('HotPsytests') ?>
            <?php $this->widget('RecommendPsytest') ?>
            <?php $this->widget('Literal') ?>
        </div>
        <!-- End of Col2 -->
		<div class="cb"></div>
    </div><!-- End of area3s -->
</div>
<script type="text/javascript">
function copyToClipBoard(){
	var clipBoardContent="";
	clipBoardContent+=this.location.href;
	if(window.clipboardData) {
		window.clipboardData.setData("Text",clipBoardContent);
		alert("复制成功，请粘贴到你的QQ/MSN上推荐给你的好友");
	} else {
		alert('无法复制，尚未兼容您使用的浏览器！');
	}	
} 
</script>
